﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class CodeUtil
{
    public const string Csharp = "c#";
    public const string Cpp = "c++";

    #region 代码类型
    public static string GetDataType(string language, string type)
    {
        switch (language)
        {
            case Csharp:
                return GetCsharpDataType(type);
            case Cpp:
                return string.Empty;
        }
        return "";
    }

    private static string GetCsharpDataType(string type)
    {
        switch (type)
        {
            case "STRING":
                return "string";
            case "BYTE":
                return "byte";
            case "INT16":
                return "Int16";
            case "INT32":
                return "Int32";
            case "INT64":
                return "Int64";
            case "FLOAT":
                return "float";
        }
        return "error";
    }


    public static string GetCsharpReadFunction(string type)
    {
        switch (type)
        {
            case "STRING":
                return "ReadString";
            case "BYTE":
                return "ReadByte";
            case "INT16":
                return "ReadInt16";
            case "INT32":
                return "ReadInt32";
            case "INT64":
                return "ReadInt64";
            case "FLOAT":
                return "ReadFloat";
        }
        return "error";
    }

    #endregion






}
